<% content_for :title do %>
  <%=h @edition.title %>
<% end %>

<% content_for :edit do %>
  <%= link_to 'Delete Entry?', 
              new_delete_request_path(:editable_id => @edition.id, 
                                      :editable_type => "Edition") %> |

  <% if session[:edit_mode] == false %>
    <%= link_to 'Edit This Page', edit_release_edition_path(@release, @edition) %> 
  <% else %>
    <%= link_to 'Finish Editing', release_edition_path(@release, @edition) %> 
  <% end %>
<% end %>

<table id="entry-table">

  <tr id="entry-table-row1">

    <td id="entry-top-pane">
      <span class="entry-title">
        <%=h @edition.title %>
      </span>

      <br />
      <span class="entry-title-sub">
        by: <%- @release.artists.each do |artist| -%>
              <%= link_to artist.name, artist %>
              <%= (artist != @release.artists.last)? "&" : "" %>
            <%- end -%>
      </span>

      <div id="top-tools">
        <% if @favorite.nil? %>
          <% if permitted_to? :create, :favorites %>
            <%= link_to 'Favorite', add_favorite_path(:id => @release.id,
                                                      :type => 'Release') %>
          <% end %>
        <% else %>
          <% if permitted_to? :destroy, :favorites %>
            <%= link_to 'Remove From Favorites', remove_favorite_path(:id => @favorite) %>
          <% end %>
        <% end %>
      </div><!-- /top-tools -->

    </td><!-- /entry-top-pane -->
  </tr><!-- /entry-table-row1 -->

  <tr id="entry-table-row2">

    <td class="entry-left-pane">

      <div id="entry-left-image">
        <%= render :partial => 'images/image_viewer',
                   :locals => {:item => @edition,
                               :gallery_path => release_edition_images_path(@release, @edition) } %>
      </div><!-- /entry-left-image -->

    </td><!-- /entry-left-pane -->

    <td class="entry-mid-pane">
      <table id="entry-mid-info">

        <tr>
          <td class="entry-info-label">Type:</td>
          <td><%=h @release.release_type %></td>
        </tr>

        <tr>
          <td class="entry-info-label">Release Dates:</td>
          <td>
		  <% @edition.edition_dates.each do |d| %>
            <%=h d.date_string_with_month %>
			<%=h (d.country.blank?) ? "" : " in " + d.country %>
			<br />
		  <% end %>
          </td>
        </tr>

        <tr>
          <td class="entry-info-label">Label:</td>
          <td>
            <% if @edition.label %>
              <%= link_to @edition.label.name, label_path(@edition.label) %>
            <% end %> 
          </td>
        </tr>

        <tr>
          <td class="entry-info-label">Catalog ID:</td>
          <td><%=h @edition.catalogID %></td>
        </tr>

        <tr>
          <td class="entry-info-label">Status:</td>
          <td><%=h @edition.status %></td>
        </tr>

        <tr>
          <td class="entry-info-label">Genre:</td>
          <td>
            <% @edition.genres.each do |genre| %>
              <strong><%= link_to genre.name, genre %></strong>
            <% end %>
          </td>
        </tr>
      </table><!-- /entry-mid-info -->
    </tr><!-- /entry-table-row2 -->

    <tr id="entry-table-row3" -->
    <td class="entry-left-pane">
      <div id="entry-left-menu">
        <ul class="tabnav">
          <%= tab('Track Listing', 'track-pane', 'active') %>
          <%= tab('Info', 'info-pane', 'inactive') %>
          <%= tab('Versions', 'version-pane', 'inactive') %>
          <%= tab('Credits', 'credits-pane', 'inactive') %>
          <%= tab('Discuss', 'forum-pane', 'inactive') %>
          <%= tab('Reviews', 'review-pane', 'inactive') %>
        </ul>
      </div><!-- /entry-left-menu -->
    </td>
 
    <td class="entry-mid-pane">
      <div id="entry-mid-content">

        <div id="track-pane">

          <h3>Track Listing</h3>
		  <% @edition.discs.each do |disc| %>
		  	
	        <p>
              <% disc.number %>
              <%=h (disc.format.blank?)? "" : disc.format + " " + disc.number.to_s %>
              <%=h (disc.title.blank?)? "" : " : " + disc.title %>
            </p>
            <%= render :partial => 'show_songs', :locals => { :songs => disc.songs } %>
		  <% end %>
        </div><!-- /track-pane -->

        <div id="info-pane" style="display: none">
          <h3>Information</h3>
          <%= simple_format(@release.info) %>
          <br />
      
          <div id="edit-history">
            <h3>Edit History</h3>
            <%= link_to 'Full History for This Page', release_edits_path(@edition) %>
          </div><!-- /edit-history -->

        </div><!-- /info-pane -->

        <div id="forum-pane"style="display: none">
          <h3><%=h @release.forum.title %></h3>  
          <%= render :partial => "forums/forum", 
                     :locals => {:forum => @release.forum} %>
        </div><!-- /forum-pane -->

        <div id="version-pane" style="display: none">
          <h3>Alternate Versions</h3>

          <% @release.editions.each do |edition| %>
            <% next if edition.id == @edition.id %>

            <div class="release">
              <img src="/images/REDUX.jpg" alt="Album Art" width="100" height="100" />
              <%= link_to edition.title, release_edition_path(@release, edition) %>
              <br />
              Year: <br />
              Format: <br />
            </div><!-- /release -->
          <% end %>

        </div><!-- /version-pane -->

        <div id="review-pane" style="display: none">
          <h3>Reviews</h3>
            <%= render :partial => 'reviews/review', 
                       :locals => {:item => @release} %>
        </div><!-- /reviews -->

        <div id="credits-pane" style="display: none">
          <h3>Credits</h3>
          <%- @edition.edition_credits.each do |credit| -%>
            <%=h credit.role %>
            <%=h (credit.details.blank?) ? "" : " [" + credit.details + "]" %>
			by <%= link_to credit.artist.name, credit.artist %>
            <br />
          <%- end -%>    
          <br />
        </div><!-- /credits -->

      </div><!-- /entry-mid-content -->
    </td>
  </tr>
</table>